package jvm.gc;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: System.gc()调用测试
 * <P> Date: 2022/3/22:9:18
 * <P> Description:
 */

public class SystemGcTest {
    public static void main(String[] args) {
        new SystemGcTest();
        System.gc();
        // 同 Runtime.getRuntime().gc();效果一样
        System.runFinalization();//强制调用类的finalize方法
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("SystemGcTest.重写了 finalize");
    }
}
